package Command;

import java.io.File;

import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Iterator;
import Command.MainCommand;
import Algo.Algo;
import DataBase.MenuTag_File;
import DirectsDB.MenuDirects;
import junit.framework.TestCase;

/**
* Description :Test for init 
* <p>
*
*@author Danielle
*/
public class InitTest extends TestCase {
	
	private MenuTag_File dataBase= new MenuTag_File();
	private MenuDirects dirDB=new MenuDirects();
	ArrayList<Algo>  algoList;
	Init initTest;
	private static MainCommand mainCommand;
	
	/**
	* Description initial all the DBs
	*/
	public void initAll()
	{
		dirDB.delAll();
		dataBase.deleteDB();
		try {
			mainCommand=new MainCommand();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/**
	* Description Test 1- add a Direct and show it run with stop
	*/
	public void testSource1() throws Exception  {
		///init the Dbs
		initAll();
		initTest=new Init();
		initTest.startParam(dataBase, dirDB, algoList);
		///add a direct:
		dirDB.addDir("C:\test");
		///start:
		initTest.start();

		///while(true){}
		initTest.stopInit();
	}
	
	/**
	* Description Test 2- add a Direct and show it run with pause stop
	*/
	public void testSource2() throws Exception  {
		///init the Dbs
		initAll();
		initTest=new Init();
		initTest.startParam(dataBase, dirDB, algoList);
		///add a direct:
		dirDB.addDir("C:\test");
		
		///start
		initTest.start();
		///pause
		initTest.pause();
		
		///while(true){}
		initTest.stopInit();
	}
	
	/**
	* Description Test 3- add a Direct and show it run with pause continue and stop
	*/
	public void testSource3() throws Exception  {
		///init the Dbs
		initAll();
		initTest=new Init();
		initTest.startParam(dataBase, dirDB, algoList);
		///add a direct:
		dirDB.addDir("C:\test");
		
		///start
		initTest.start();
		///pause
		initTest.pause();
		Thread.sleep(800);
		///continue:
		initTest.cont();
		System.out.println("CONT");
		
		///while(true){}
		initTest.stopInit();
	}

}
